import functools


def unmashal_witch_class(msgcls):
    def wrapper(func):
        @functools.wraps(func)
        def event_handle(self, sid, data, *args, **kwargs):
            msg = msgcls(data)
            return func(self, sid, msg, *args, **kwargs)

        return event_handle

    return wrapper
